{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bf3b6859-e227-4034-b2a1-4c83dfb2fdb9",
   "metadata": {},
   "outputs": [],
   "source": [
    "import boto3\n",
    "from pathlib import Path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c9d11a6f-7e2b-4125-ae13-534c97c105ed",
   "metadata": {},
   "outputs": [],
   "source": [
    "model_layout = Path(f'mnist-svm.joblib')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "13641703-b90f-45fa-846a-1d87eb109d48",
   "metadata": {},
   "outputs": [],
   "source": [
    "endpoint_url = 'http://10.12.24.21:9000'\n",
    "access_key = '53t7huKOrCKaVov2BIHu'\n",
    "secret_key = 'oSRW97FfCK7Ujcl5K4gefja62ykZ5Aki3kJfjFFQ'\n",
    "s3_bucket_name = 'moduleserver'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f6a50d2e-3bca-4437-888d-7c6f8fad8de0",
   "metadata": {},
   "outputs": [],
   "source": [
    "s3 = boto3.client('s3',\n",
    "                  endpoint_url=endpoint_url,\n",
    "                  aws_access_key_id=access_key,\n",
    "                  aws_secret_access_key=secret_key)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b60c8914-b0f7-48cc-b27d-2aa27db638b3",
   "metadata": {},
   "outputs": [],
   "source": [
    "s3.upload_file(str(model_layout), s3_bucket_name, f'c/mnist-svm.joblib')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5dec1982-49a6-4619-b330-be7bc398f95c",
   "metadata": {},
   "outputs": [],
   "source": [
    "s3.list_objects(Bucket=s3_bucket_name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0b641b45-0fec-4c14-886e-4135027340ad",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.9.7",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
